#include <rtthread.h>

#include <rtdevice.h>

static void threadLed(void *p)
{
    int led1, led2, led3;

    led1 = rt_pin_get("pc0");
    led2 = rt_pin_get("pc1");
    led3 = rt_pin_get("pc2");

    rt_pin_mode(led1, PIN_MODE_OUTPUT);
    //rt_pin_mode(led2, PIN_MODE_OUTPUT);
    //rt_pin_mode(led3, PIN_MODE_OUTPUT);

    while (1)
    {
        rt_pin_write(led1, 0);
        rt_thread_mdelay(500);
        rt_pin_write(led1, 1);
        rt_thread_mdelay(500);
    }
}

int taskLedInit(void)
{
    rt_thread_t t;
    int ret = -1;

    t = rt_thread_create("led", threadLed, 0,
                         1024, 20, 5);
    if (t)
        ret = rt_thread_startup(t);

    return ret;
}
INIT_APP_EXPORT(taskLedInit);
